<include file="Public/header"/>
<body class="body-bg">
<div class="park-header">
    <div class="park-header__title">限时抢购</div>
    <div class="park-header__left park-back">
        <i class="iconfont icon-fanhui"></i>
    </div>
</div>
<div class="container">
    <volist name="purchase" id="val">
    <div class="park__goods" style="margin-top: 0.2rem;">
        <div class="goods-buying" data-time="{$val.end_time}">
            <div class="goods-buying__time">距离结束时间:<em class="park__countDown"><span class="hour">00</span>:<span class="minute">00</span>:<span class="second">00</span></em></div>
            <div class="goods-buying__count">剩余:<span>{$val.use_number}</span>件</div>
        </div>
        <ul>
            <li>
                <div class="park-goods__pic" style="background-image: url('{$val.thumb}')"></div>
                <div class="park-goods__info">
                    <p class="name">{$val.goods_name}</p>
                    <p class="desc">{$val.store_name} 提供</p>
                    <p class="spec">规格：{$val.spec_name}</p>
                    <p class="price-line">
                        <span class="price">￥<em>10</em>.00</span>
                        <span class="Oprice">￥<em>{$val.spec_mk_price}</em></span>
                    </p>
                </div>
                <div class="park-goods__pos">
                    <div class="cart" onclick="add_cart('{$val.goods_id}','{$val.store_id}','{$val.spec_id}','{$val.id}');">
                        <i class="iconfont icon-cart"></i>
                    </div>
                </div>
            </li>
        </ul>
    </div>
    </volist>
</div>
<div class="park-fixed-cart" onclick="window.location='/Home/Cart/index/';">
    <i class="iconfont icon-cart"></i>
    <if condition="$cart_number gt 0">
        <span class="num" id="cart_number">{$cart_number}</span>
    </if>
</div>
<script src="__ROOT__/Public/Home/js/CountDown.js"></script>
<script src="__ROOT__/Public/Home/layer/layer.js"></script>
<script>
    $(function () {
        $.each($('.goods-buying'), function (index, item) {
            var time = $(this).attr('data-time');
            new CountDown($(item).find('.park__countDown'),time);
        });
    });
    function add_cart(goods_id,store_id,spec_id,pro_id){
        $.post('/Home/Cart/add_cart/',{goods_id:goods_id,store_id:store_id,spec_id:spec_id,goods_number:1,pro_type:3,type:2,pro_id:pro_id},						function(data){
            layer.open({
                content:data.msg
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });
            if(data.code==200){
                var number = $('#cart_number').html();
                $('#cart_number').html(parseInt(number)+1);
            }
        },'json');
    }
</script>
</body>
</html>